<?php
require("includes/basic.php");
$projid=$_POST['projctid'];

if(isset($_POST['addmodule']) && $_POST['addmodule']=='Add Module')
{
	foreach($_POST['checkp'] as $p => $sid)
	{
		$phaseid=$sid;
	}
	$modid=$_POST['modid'];
	$addmod=mysql_query("insert into phase_module (`project_id`,`phase_id`,`module_id`) values ('$projid','$phaseid','$modid')");
}
if(isset($_POST['assignm']) && $_POST['assignm']=='Assign Module')
{
	foreach($_POST['checkp'] as $p => $sid)
	{
		$phaseid=$sid;
	}
	$resource=$_POST['assignmto'];
	foreach($_POST['checkm'] as $m => $mid)
	{
		$assignmod=mysql_query("insert into task_assigned_to (`task_assigned_to`,`task_assigned_on`,`task_assigned_by`,`project_id`,`phase_id`,`module_id`,`role_id`) values ('$resource',sysdate(),'$userId','$projid','$phaseid','$mid','3')"); 
	}
}
header("location:open-project.php?p=$projid");
?>